#include "app_touch_screen.h"
#include "app_schd_task.h"

ORB_DEFINE(touch_screen_ctrl,touch_screen_t);

#if DEVICE_TOUCH_SCREEN_ENABLE

static void touch_screen_can_send(uint8_t *buf,uint16_t len);

static void touch_screen_can_send(uint8_t *buf,uint16_t len)
{
	CanTxMsg TxMessage = {0};

	TxMessage.StdId=0;	 
	TxMessage.ExtId=CANID_TOUCH_SCREEN;	 
	TxMessage.IDE= CAN_Id_Extended; 
	TxMessage.RTR=CAN_RTR_Data;		  

	TxMessage.DLC = len;
	memcpy(&TxMessage.Data[0],buf,len);

	CAN_Transmit(CAN1, &TxMessage);
}

static void touch_orb_advertise_init(void)
{
	uint8_t ret = 0;

	ret = orb_advertise(ORB_ID(touch_screen_ctrl));
	if(!ret) printf("[%s] advertise error.\r\n","touch_screen_ctrl struct");	
}

#endif

void app_touch_screen_init(void)
{
#if DEVICE_TOUCH_SCREEN_ENABLE

	touch_orb_advertise_init();

#endif
}


